﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Collections;

using XJX.BusinessLayer;

namespace XJX.Page
{
    /// <summary>
    ///Family 的摘要说明
    /// </summary>
    public class Borrow
    {
        public Borrow()
        {
            //
            //TODO: 在此处添加构造函数逻辑
            //
        }

        //借书动作
        public static bool Add_New_Borrow
            (
            string juid,
            string cuid,
            string bid,
            out int ReturnValue
            )
        {
            bool b;

            string str = System.Configuration.ConfigurationManager.ConnectionStrings["DataConn"].ConnectionString;

            XJX.BusinessLayer.Borrow bs = new XJX.BusinessLayer.Borrow(str);

            try
            {
                b = bs.Add_New_Borrow(juid, cuid, bid, out ReturnValue);
            }
            catch (SqlException e)
            {
                throw new System.Exception(e.Message);
            }
            return b;
        }

        //根据传入的过程名称，分别得到正借来的、正借出的、曾经借来的、曾经借出的图书列表。
        public static string Get_Borrow_Book_List(string proc,string UID, int PageIndex, int PageSize)
        {
            string str = System.Configuration.ConfigurationManager.ConnectionStrings["DataConn"].ConnectionString;

            XJX.BusinessLayer.Borrow bs = new XJX.BusinessLayer.Borrow(str);

            Hashtable ht = bs.Get_Borrow_Book_List(proc,UID, PageIndex, PageSize);
            return XJX.BusinessLayer.JSON.Encode(ht);
        }


        //根据传入的过程名称，分别得到正借来的确认和未确认、正借出的确认和未确认的图书列表。
        public static string Get_Borrow_Book_List(string proc, string UID)
        {
            string str = System.Configuration.ConfigurationManager.ConnectionStrings["DataConn"].ConnectionString;

            XJX.BusinessLayer.Borrow bs = new XJX.BusinessLayer.Borrow(str);

            Hashtable ht = bs.Get_Borrow_Book_List(proc, UID);
            return XJX.BusinessLayer.JSON.Encode(ht);
        }
    }

    ////////////////////////////////////////////////////////////////////////////以下系统信息类属性

    public class BorrowInfo
    {
        public int ID;
        public string Sname;
        public string RXNF;
        public string CID;
        public string Sex;
        public string Fname;
        public string Mobile;
        public string PWD;
        public string Flag;
        public int Lnum;
        public string UID;
        public int Bnum;
    }

}